import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { initAMapApiLoader } from '@vuemap/vue-amap'
const app = createApp(App)
const pinia = createPinia()
initAMapApiLoader({
  // 替换为你的高德地图开发密钥
  key: '32c78303070a7b7d221b04d0927c5ff8',
  // 加载的地图插件等
  plugin: ['AMap.Geolocation', 'AMap.Marker']
})

createApp(App).mount('#app')
app.use(pinia)
app.use(ElementPlus)
app.use(router)

// 处理 ResizeObserver 错误 - 增强版
const originalConsoleError = window.console.error;
window.console.error = (...args) => {
  if (args.length > 0 && typeof args[0] === 'string' && args[0].includes('ResizeObserver')) {
    // 忽略 ResizeObserver 错误
    return;
  }
  originalConsoleError.apply(console, args);
};

// 捕获未处理的错误
window.addEventListener('error', (event) => {
  if (event.message && event.message.includes('ResizeObserver')) {
    event.stopImmediatePropagation();
    event.preventDefault();
    return false;
  }
}, true);

app.mount('#app')
